| Total Complexity | 5 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; |
||
| 8 | |||
| 9 | @Entity() |
||
| 10 | export class Discount { |
||
| 11 | @PrimaryGeneratedColumn('uuid') |
||
| 12 | private id: string; |
||
| 13 | |||
| 14 | @Column('enum', { enum: DiscountType, nullable: false }) |
||
| 15 | protected type: DiscountType; |
||
| 16 | |||
| 17 | @Column({ type: 'integer', nullable: false }) |
||
| 18 | private amount: number; |
||
| 19 | |||
| 20 | @Column({ type: 'integer', nullable: false }) |
||
| 21 | private value: number; |
||
| 22 | |||
| 23 | @ManyToOne(() => School, { nullable: false, onDelete: 'CASCADE' }) |
||
| 24 | private school: School; |
||
| 25 | |||
| 26 | constructor( |
||
| 27 | type: DiscountType, |
||
| 28 | amount: number, |
||
| 29 | value: number, |
||
| 30 | school: School |
||
| 31 | ) { |
||
| 32 | this.type = type; |
||
| 33 | this.amount = amount; |
||
| 34 | this.value = value; |
||
| 35 | this.school = school; |
||
| 36 | } |
||
| 37 | |||
| 38 | public getId(): string { |
||
| 39 | return this.id; |
||
| 40 | } |
||
| 41 | |||
| 42 | public getAmount(): number { |
||
| 43 | return this.amount; |
||
| 44 | } |
||
| 45 | |||
| 46 | public getValue(): number { |
||
| 47 | return this.value; |
||
| 48 | } |
||
| 49 | |||
| 50 | public getType(): DiscountType { |
||
| 51 | return this.type; |
||
| 52 | } |
||
| 53 | |||
| 54 | public getSchool(): School { |
||
| 55 | return this.school; |
||
| 56 | } |
||
| 58 |